#ifndef CHARACTER_SERVER_H
#define CHARACTER_SERVER_H

#include <SFML/Network.hpp>
#include <Box2D/Box2D.h>

#include "DirectionPosition.h"
#include "ContactObject.h"
#include "GemServer.h"
#include "ServerWorldObjects.h"

class CharacterServer : public ContactObject {

public :
	/*Variables pour Box2D*/
	b2BodyDef characterBodyDef;
	b2Vec2 playerPosition;
	b2PolygonShape dynamicBox; 
	b2Vec2 vel;
	b2Body* body; 
	b2FixtureDef fixtureDef;

	bool testJump;
	bool youwin;

	characterDirection chDirection;
	characterAction chAction;

	sf::Thread* threadTestJump;		
	
	float playerWidth;
	float playerHeight;
	int nbPoints;

	CharacterServer(float posX, float posY);
	void initialiseB2D(b2World* world);
	void send(sf::TcpSocket& socket);
	void beforeJump();
	void testFall();
	void die();
	void win();
	void collect(GemServer* gem, ServerWorldObjects* swo);
	void stop();

	virtual void startContact();
	virtual void endContact();

	bool hasWon();
};


#endif